package com.online.service;

import com.online.dao.CourseMapper;
import com.online.entity.Course;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements CourseService  {

    @Autowired
    CourseMapper courseMapper;

    @Override
    public List<Course> showCourseName(String teacherNumber) {
        return courseMapper.selectCourseNameByTeacherNumber(teacherNumber);
    }

    @Override
    public int deleteARecord(Integer courseId, String teacherNumber) {
        return courseMapper.deleteCourseByTeacherNumber(courseId,teacherNumber);
    }

    @Override
    public int inserACourse(Course course) {
        return courseMapper.insertACourse(course);
    }

    @Override
    public Course selectACourse(String courseName, String teacherNumber) {
        return courseMapper.selectACourse(courseName,teacherNumber);
    }

    @Override
    public Course selectACourseByCourseId(Integer courseId) {
        return courseMapper.selectCourseById(courseId);
    }
}
